package course_platform;

import java.util.ArrayList;
import java.util.List;

public class Course {
    private String code; // 课程编号
    private String courseName; // 课程名称
    private String location; // 上课地点
    private String time; // 上课时间
    private List<Teacher> teachers; // 授课教师列表
    private List<Student> students; // 选修该课程的学生列表

    public Course(String code, String courseName, String location, String time) {
        this.code = code;
        this.courseName = courseName;
        this.location = location;
        this.time = time;
        this.teachers = new ArrayList<>();
        this.students = new ArrayList<>();
    }

    public String getCode() {
        return code;
    }

    public String getCourseName() {
        return courseName;
    }

    public String getLocation() {
        return location;
    }

    public String getTime() {
        return time;
    }

    public List<Student> getStudents() {
        return students;
    }

    public void addStudent(Student student) {
        if (!students.contains(student)) {
            students.add(student);
        }
    }

    public void addTeacher(Teacher teacher) {
        if (!teachers.contains(teacher)) {
            teachers.add(teacher);
        }
    }

    public List<Teacher> getTeachers() {
        return teachers;
    }
}